<?php

/**
 * JingYao-backend
 *
 * @link     https://gitee.com/wang-zhihui-release/jingyao-backend
 * @apiDocument https://gitee.com/wang-zhihui-release/jingyao-backend/wikis/
 */

namespace Database\Seeders;

use App\Enums\CheckStatusEnum;
use App\Enums\UserIdentityEnum;
use App\Models\House;
use App\Models\HouseUserBind;
use App\Models\PassCard;
use App\Models\User;
use App\Models\UserProfile;
use Illuminate\Database\Seeder;

class PassCardSeeder extends Seeder
{
    /**
     * Run the database seeds.
     */
    public function run()
    {
        for ($i = 0; $i < 10; ++$i) {
            $user = User::factory()->create([
                'identity' => UserIdentityEnum::FLOW_USER,
            ]);

            $userProfile = UserProfile::factory()->create([
                'user_id' => $user->id,
                'id_card_number' => '1212121212121',
            ]);

            $houser = User::factory()->create([
                'identity' => UserIdentityEnum::HOUSER,
            ]);

            $houserProfile = UserProfile::factory()->create([
                'user_id' => $houser->id,
                'id_card_number' => '9999999',
            ]);

            $house = House::factory()->create([
                'houser_user_id' => $houser->id,
            ]);

            $bind = HouseUserBind::query()->create([
                'house_id' => $house->id,
                'id_card_number' => '1212121212121',
                'user_name' => $user->name,
            ]);

            PassCard::factory()->create([
                'user_id' => $user->id,
                'check_status' => CheckStatusEnum::CHECK_ING,
            ]);
        }
    }
}
